<!--  -->
<template>
  <el-form :label-width="formLabelWidth">
    <el-form-item :label="title" style="margin-bottom:0px;">
      <el-radio-group :disabled="isDisabled" v-model="textAlign">
        <el-radio :label="'left'">靠左</el-radio>
        <el-radio :label="'center'">居中</el-radio>
        <el-radio :label="'right'">靠右</el-radio>
      </el-radio-group>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  mounted () {
    this.textAlign = this.defValue
    if (!this.textAlign) {
      this.textAlign = 'left'
    }
  },
  props: {
    formLabelWidth: {
      type: String,
      default: '120px'
    },
    defValue: {
      type: String
    },
    chgValue: {
      type: Function
    },
    title: {
      type: String,
      default: '显示位置'
    },
    isDisabled: {
      type: Boolean,
      default: false
    }
  },
  data () {
    return {
      textAlign: ''
    }
  },
  watch: {
    textAlign: {
      handler () {
        this.chgValue(this.textAlign)
      },
      deep: true
    }
  }
}

</script>
